<template>
	<view class="poRel" style="background-color: #F6F6F6;min-height: 100vh;">
		<view class="wid100 poAbs"
			style="height: 775rpx;background: linear-gradient(#e9ffe4, #F6F6F6);top: 0;z-index: 1;"></view>
		<view class="poFix wid100" style="background: #e9ffe4;top: 0;z-index: 11;">
			<!-- 状态栏高度 -->
			<view :style="{ height: `${statusBarHeight}px` }"></view>
			<!-- 自定义导航栏高度 并 居中 -->
			<view class="dis disAl disJuC poRel" :style="{height: `${barHeight}px`}">
				<view class="poAbs" style="width: 32rpx;height: 32rpx;left: 22rpx;" @click="fanhui()">
					<image src="../../static/fanhui.png" class="wh100"></image>
				</view>
				<view class="foSi35" style="line-height: 36rpx;">订单详情</view>
			</view>
		</view>
		<view :style="{ height: `${statusBarHeight+barHeight}px` }"></view>
		<view class="poRel mar-top30" style="z-index: 2;">
			<view v-if="info.deliveryName!='商家配送'">
				<view v-if="info.state==1" class="wid90 mar bacFFF borRad20 dis disAl disJuC fowe800"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);font-size: 66rpx;height: 200rpx;">未支付
				</view>
				<view v-if="info.state==12" class="wid90 mar bacFFF borRad20 dis disAl disJuC fowe800"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);font-size: 66rpx;height: 200rpx;">
					等待商家确认</view>
				<view v-if="info.state>1 && info.state<=4" class="wid90 mar bacFFF borRad20"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view style="height: 54rpx;"></view>
					<view class="dis disAl disJuC">
						<view class="dis foSi22" style="color: #999999;">
							<view class="textCen mar-right20">
								<view class="mar" style="width: 53rpx;height: 57rpx;">
									<image src="../../static/yixiadan.png" class="wh100"></image>
								</view>
								<view class="mar-top10">已下单</view>
							</view>
							<view
								style="width: 98rpx;border-bottom: 1rpx dashed #E3D4D4;margin-top: 28rpx;height: 1rpx;">
							</view>
							<view class="textCen mar-left20 mar-right20">
								<view class="mar" style="width: 47rpx;height: 57rpx;">
									<image src="../../static/zhizuozhong.png" class="wh100"></image>
								</view>
								<view class="mar-top10">制作中</view>
							</view>
							<view
								style="width: 98rpx;border-bottom: 1rpx dashed #E3D4D4;margin-top: 28rpx;height: 1rpx;">
							</view>
							<view class="textCen mar-left20">
								<view class="mar" style="width: 53rpx;height: 57rpx;">
									<image src="../../static/wanchengdingdan.png" class="wh100"></image>
								</view>
								<view class="mar-top10">已完成</view>
							</view>
						</view>
					</view>
					<!-- <view class="textCen" style="margin-top: 50rpx;">
						<view class="fowe800" style="line-height: 52rpx;font-size: 66rpx;"><text v-for="(v,i) in zqmArr" :key='i'>{{v}}</text></view>
						<view class="f26 mar-top10" style="color: #666666;">取单号</view>
					</view> -->
					<view style="height: 44rpx;"></view>
				</view>
				<view v-if="info.state>4 && info.state<12" class="wid90 mar bacFFF borRad20"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view style="height: 48rpx;"></view>
					<view class="textCen">
						<view class="fowe800 foSi35">订单已完成</view>
						<!-- <view class="fowe800 mar-top15" style="line-height: 52rpx;font-size: 66rpx;"><text v-for="(v,i) in zqmArr" :key='i'>{{v}}</text></view>
						<view class="f26 mar-top10" style="color: #666666;">取单号</view> -->
					</view>
					<!-- <view class="dis disAl disJuC f26" style="margin-top: 50rpx;">
						<view class="dis disAl disJuC hei60 mar-right30" :style="{color: tColor,border: '1rpx solid '+tColor}" style="width: 168rpx;">申请开票</view>
						<view class="dis disAl disJuC hei60 mar-right30" :style="{color: tColor,border: '1rpx solid '+tColor}" style="width: 168rpx;">再来一单</view>
					</view> -->
					<view style="height: 44rpx;"></view>
				</view>
				<swiper class="wid90 mar mar-top30" style="height: 206rpx;" :autoplay="true" :interval="5000"
					duration="500">
					<block v-for="(v,i) in 4" :key='i'>
						<swiper-item class="wh100">
							<image src="https://xzj.7yu.cc/web/static/yb_wm/1/2024/07/15/202407151446375100.jpg"
								class="wh100 borRad20"></image>
						</swiper-item>
					</block>
				</swiper>
				<view v-if="info.state>4" class="mar-top30 wid90 mar borRad20 bacFFF"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar dis disAl disJuB" style="height: 110rpx;">
						<view class="dis disAl disJuC" style="width: 49%;">
							<image src="../../static/huiyuan1.png" style="width: 24rpx;height: 24rpx;"></image>
							<view class="dis disAl f28 fowe600 mar-left10">
								<text>经验值</text>
								<text class="mar-left20" :style='{color:tColor}'>+30</text>
							</view>
						</view>
						<view style="height: 57rpx;width: 1rpx;background-color: #D0D0D0;"></view>
						<view class="dis disAl disJuC" style="width: 49%;">
							<image src="../../static/jifen1.png" style="width: 24rpx;height: 24rpx;"></image>
							<view class="dis disAl f28 fowe600 mar-left10">
								<text>积分</text>
								<text class="mar-left20" :style='{color:tColor}'>+30</text>
							</view>
						</view>
					</view>
				</view>
				<view class="wid90 mar bacFFF borRad20 mar-top30"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar">
						<view class="dis disAl disJuB" style="border-bottom: 1rpx dashed #E3D4D4;height: 74rpx;">
							<view class="dis disAl">
								<image src="../../static/sahngjia.png" style="width: 32rpx;height: 30rpx;"></image>
								<view class="dis disAl mar-left10 fowe800">
									<text class='t-o-e f30'>{{info.storeName}}</text>
									<text class="iconfont iconright ml5 c9 f30" style="color: #000;"></text>
								</view>
							</view>
							<view class="dis disAl">
								<view @click.stop="bddh(info)" style="width: 48rpx;height: 48rpx;">
									<image src="../../static/dianhua1.png" class="wh borRad50"></image>
								</view>
								<view @click.stop="ckwz(info)" class="mar-left20" style="width: 48rpx;height: 48rpx;">
									<image src="../../static/danghang1.png" class="wh borRad50"></image>
								</view>
							</view>
						</view>
						<block v-for="(v,i) in info.goodsArr" :key="i">
							<view class="dis mar-top20">
								<view class="wid25" style="height: 132rpx;">
									<image :src="v.icon" class="borRad20 hei100" style="width: 132rpx;"></image>
								</view>
								<view style="width: 75%;">
									<view style="height: 10rpx;"></view>
									<view class="dis disJuB">
										<view class="wid70 f28 fowe800 webkitLineClamp">{{v.name}}</view>
										<view class="f24" style="color: #737373;">x{{v.num}}</view>
									</view>
								</view>
							</view>
						</block>
						<view v-if="info.platformCouponPreferential>0" class="mar-top15 dis disAl disJuB mar-top20">
							<view class="dis disAl">
								<view class="dis disAl disJuC borRad10 coFFF f20 coFFF"
									style="width: 28rpx;height: 28rpx;">券</view>
								<view class="mar-left10 f24 fowe600">{{system.custom.systemRedbag}}</view>
							</view>
							<view class="f24 fowe600" :style='{color:tColor}'>-{{sl+system.custom.money}}</view>
						</view>
						<view class="dis disAl mar-top20"
							style="height: 92rpx;border-top: 1rpx dashed #E3D4D4;justify-content: flex-end;">
							<view class="fowe800 f24">
								<text>已优惠</text>
								<text :style='{color:tColor}'>{{sl+(system.custom.money||0)}}</text>
								<text class="mar-left10">共{{sl}}</text>
								<text class="f32">{{info.money}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="wid90 mar bacFFF borRad20 mar-top30"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar">
						<view class="fowe800 f32 dis disAl" style="border-bottom: 1rpx dashed #E3D4D4;height: 74rpx;">
							用餐信息</view>
						<view class="dis disAl disJuB mar-top20 f24 fowe800">
							<view style="color: #737373;">用餐方式</view>
							<view>{{info.deliveryName}}</view>
						</view>
						<view v-if="info.deliveryMode==10" class="dis disAl disJuB mar-top20 f24 fowe800">
							<view style="color: #737373;">就餐时间</view>
							<view>{{info.serviceAt}}</view>
						</view>
						<view style="height: 37rpx;"></view>
					</view>
				</view>
				<view v-if="info.state>1" class="wid90 mar bacFFF borRad20 mar-top30"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar">
						<view class="fowe800 f32 dis disAl" style="border-bottom: 1rpx dashed #E3D4D4;height: 74rpx;">
							订单信息</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">订单编号</view>
							<view class="dis disAl">
								<view class="mar-right10">{{info.outTradeNo}}</view>
								<view @click='util.fz(info.outTradeNo)' class="dis disAl disJuC f22"
									style="width: 56rpx;height: 29rpx;border: 1rpx solid #737373;color: #737373;">复制
								</view>
							</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">下单时间</view>
							<view>{{timeToDate(info.createdAt)}}</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">支付方式</view>
							<view class="fowe600">{{payName(info.payMode)}}</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">支付金额</view>
							<view class="fowe600">{{sl+info.money}}</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">备注信息</view>
							<view class="fowe600">{{info.userNote}}</view>
						</view>
						<view style="height: 30rpx;"></view>
					</view>
				</view>

			</view>
			<view v-if="info.deliveryName=='商家配送'">
				<view v-if="info.state==1" class="textCen fowe800 foSi50">未支付</view>
				<view v-if="info.state==12" class="textCen fowe800 foSi50">等待商家确认</view>
				<view v-if="info.state>4 && info.state!=12" class="textCen fowe800 foSi50">订单已完成</view>
				<view v-if="info.state>1 && info.state<=4" class="textCen fowe800 foSi50">商家已接单</view>
				<view v-if="info.state>1 && info.state<=4" class="textCen foSi20 mar-top20" style="color: #8B8686;">
					您的商品正在制作中，请您耐心等待</view>
				<view class="wid90 mar bacFFF borRad20 mar-top30 dis" v-if="info.state!=1"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);padding: 35rpx 0;justify-content: space-around;">
					<view v-if="info.state==12" class="wid33 dis disJuC" @click.stop="quxiao(info,1)">
						<view>
							<view class="dis disAl disJuC" style="height: 60rpx;">
								<image src="../../static/quxiao1.png" style="width: 48rpx;height: 48rpx;"></image>
							</view>
							<view class="foSi25 mar-top15 fowe600">取消订单</view>
						</view>
					</view>
					<view v-if="info.state>1 && info.state<=4" class="wid33 dis disJuC"
						@click.stop="cuidan(info)">
						<view>
							<view class="dis disAl disJuC" style="height: 60rpx;">
								<image src="../../static/cuidan1.png" style="width: 54rpx;height: 53rpx;"></image>
							</view>
							<view class="foSi25 mar-top15 fowe600">催单</view>
						</view>
					</view>
					<view class="wid33 dis disJuC" @click.stop="bddh(info)">
						<view>
							<view class="dis disAl disJuC" style="height: 60rpx;">
								<image src="../../static/lianxi1.png" style="width: 43rpx;height: 47rpx;"></image>
							</view>
							<view class="foSi25 mar-top15 fowe600">联系商家</view>
						</view>
					</view>
				</view>
				<view class="wid90 mar bacFFF borRad20 mar-top30"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar">
						<view class="dis disAl disJuB" style="border-bottom: 1rpx dashed #E3D4D4;height: 74rpx;">
							<view class="dis disAl">
								<image src="../../static/sahngjia.png" style="width: 32rpx;height: 30rpx;"></image>
								<view class="dis disAl mar-left10 fowe800">
									<text class='t-o-e f30'>{{info.storeName}}</text>
								</view>
							</view>
						</view>
						<block v-for="(v,i) in info.goodsArr" :key="i">
							<view class="dis mar-top20">
								<view class="wid25" style="height: 132rpx;">
									<image :src="v.icon" class="borRad20 hei100" style="width: 132rpx;"></image>
								</view>
								<view class="fowe800" style="width: 75%;">
									<view style="height: 10rpx;"></view>
									<view class="dis disJuB">
										<view class="wid70 f28 webkitLineClamp">
											<text>{{v.name}}</text>
											<text v-if="v.data" class="f24" style="color: #737373;">({{v.data}})</text>
											<text class="f24 mar-left10" style="color: #737373;">x{{v.num}}</text>
										</view>
										<view class="f24" style="color: #737373;">单价：{{sl+v.kg_price}}/{{v.unit?v.unit:'斤'}}</view>
									</view>
									<view class="dis disJuB mar-top10 f24" style="color: #737373;">
										<view>重量：{{v.weight}}斤</view>
										<view>支付：{{sl}}{{v.money}}</view>
									</view>
								</view>
							</view>
						</block>
						<view class="mar-top15 dis disAl disJuB mar-top20">
							<view class="dis disAl">
								<view class="mar-left10 f24 fowe600">包装费</view>
							</view>
							<view class="f24 fowe600">{{sl+info.boxMoney}}</view>
						</view>
						<view class="mar-top15 dis disAl disJuB mar-top20">
							<view class="dis disAl">
								<view class="mar-left10 f24 fowe600">配送费</view>
							</view>
							<view class="f24 fowe600">{{sl+info.preferentialMoney}}</view>
						</view>
						<view v-if="info.state==12" class="hei20"></view>
						<view v-if="info.state!=12" class="dis disAl mar-top20"
							style="height: 92rpx;border-top: 1rpx dashed #E3D4D4;justify-content: flex-end;">
							<view class="f24">
								<text style="color: #737373;">共{{info.num}}件商品</text>
								<text class="mar-left10 fowe800">小计</text>
								<text class="f32 fowe800 mar-left10">{{sl+info.money}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="wid90 mar bacFFF borRad20 mar-top30"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar">
						<view class="fowe800 f32 dis disAl" style="border-bottom: 1rpx dashed #E3D4D4;height: 74rpx;">
							配送信息</view>
						<view class="dis disAl disJuB mar-top20 f24 fowe800">
							<view style="color: #737373;">送达时间</view>
							<view>{{info.serviceAt}}</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24 fowe800">
							<view style="color: #737373;">配送方式</view>
							<view>{{info.deliveryName}}</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24 fowe800">
							<view style="color: #737373;">收货地址</view>
							<view style="width: 60%;text-align: right;">
								<view>{{info.address}}</view>
								<view>{{info.receivedName}} ({{info.receivedTel}})</view>
							</view>
						</view>
						<view style="height: 37rpx;"></view>
					</view>
				</view>
				<view v-if="info.state>1 && info.state!=12" class="wid90 mar bacFFF borRad20 mar-top30"
					style="box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(199,199,199,0.16);">
					<view class="wid90 mar">
						<view class="fowe800 f32 dis disAl" style="border-bottom: 1rpx dashed #E3D4D4;height: 74rpx;">
							订单信息</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">取单号</view>
							<view class="fowe600"><text v-for="(v,i) in zqmArr" :key='i'>{{v}}</text></view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">订单编号</view>
							<view class="dis disAl">
								<view class="mar-right10">{{info.outTradeNo}}</view>
								<view @click='util.fz(info.outTradeNo)' class="dis disAl disJuC f22"
									style="width: 56rpx;height: 29rpx;border: 1rpx solid #737373;color: #737373;">复制
								</view>
							</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">下单时间</view>
							<view>{{timeToDate(info.createdAt)}}</view>
						</view>
						<view class="dis disAl disJuB mar-top20 f24">
							<view style="color: #737373;">支付方式</view>
							<view class="fowe600">{{payName(info.payMode)}}</view>
						</view>
						<view style="height: 30rpx;"></view>
					</view>
				</view>
			</view>

			<view style="height: 50rpx;"></view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	import {
		wxShare,
		getSLink,
	} from "@/common/wechat-util.js"
	import {
		utilMixins
	} from "@/common/util-mixins.js"
	import utils from '@/common/utils.js'
	import bkB from '@/components/common/block-b.vue'
	import MgCell from '@/components/common/mg-cell.vue'
	import mgPopup from '@/components/common/popup.vue'
	import sqBtn from '@/components/common/sq-btn.vue'
	export default {
		name: 'order-dl',
		components: {
			bkB,
			MgCell,
			mgPopup,
			sqBtn,
		},
		data() {
			return {
				statusBarHeight: 0,
				barHeight: 0,
				info: {},
				stime: '',
				latitude: '',
				longitude: '',
				covers: [],
				line: [],
				showRed: false,
				hbId: '',
				qcmsrc: '',
			}
		},
		onLoad(options) {
			// 状态栏高度
			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
			// 胶囊数据
			const {
				top,
				height
			} = wx.getMenuButtonBoundingClientRect();
			// 自定义导航栏高度 = 胶囊高度 + 胶囊的padding*2, 如果获取不到设置为38
			this.barHeight = height ? height + (top - this.statusBarHeight) * 2 : 38;
			this.getSystem()
			this.util.setNT('订单详情')
			this.orderId = options.id
			this.getInfo()
		},
		mixins: [utilMixins],
		computed: {
			...mapState({
				orderset: state => state.config.orderset,
			}),
			orderState() {
				let str1 = '',
					str2 = '',
					str3 = '',
					strimg = ''
				switch (+this.info.state) {
					case 1:
						str1 = '待支付'
						str2 = `剩余支付时间: ${this.stime[2]}:${this.stime[3]}（超过${this.orderset.closeTime}分钟未支付，订单将自动取消哦！)`
						break;
					case 2:
						// str1 = '等待商家接单'
						// str2 = '请耐心等待商家接单'
						str1 = '下单成功'
						str2 = '订单已提交，等待商家接单'
						strimg = 'xdcg'
						break;
					case 3:
						// str1 = '商家已接单'
						// str2 = this.info.deliveryMode != 10 ? '商家已接单，正在准备中，请耐心等待' : '请尽快到店自取'
						str1 = '商家已接单'
						str2 = this.info.deliveryMode != 10 ? '您的商品正在制作中，请您耐心等待' : '您的商品正在制作中，请您耐心等待'
						strimg = 'sjyjd'
						break;
					case 4:
						if (this.info.deliveryMode != 10) {
							// str1 = '订单配送中'
							// str2 = '配送平台'
							str1 = '商品派送中'
							str2 = `您的订单由${this.info.deliveryName}派送中,请您耐心等待`
							// str3 = `${this.info.deliveryName}`
							strimg = 'psz'
						} else {
							// str1 = '待取货'
							// str2 = '请您尽快到店取货'
							str1 = '待取货'
							str2 = `您的订单制作完成,请前往门店自取,(${this.system.custom.orderNumber}: #${this.info.takeNo})`
							// str3 = `取货码:${this.info.selfCode}`
							strimg = 'dqc'
						}
						break;
					case 5:
					case 6:
						str1 = '订单已完成'
						str2 = '感谢您对我们的信任，期待再次光临'
						strimg = 'ddywc'
						break;
					case 7:
						str1 = '订单已取消'
						str2 = '感谢您对我们的信任，期待再次光临'
						str3 = '取消原因：订单超时或未支付'
						break;
					case 8:
						str1 = '商家拒单'
						str2 = '非常抱歉！感谢您对我们的信任，期待再次光临'
						str3 = this.info.refuseReason && '拒单原因：' + this.info.refuseReason
						break;
					case 9:
						str1 = '申请退款中'
						str2 = '您正在申请订单退款，请耐心等待门店处理'
						str3 = this.info.cancelReason && '取消原因：' + this.info.cancelReason
						break;
					case 10:
						str1 = '订单已退款'
						str2 = '感谢您对我们的信任，期待再次光临'
						break;
					case 11:
						str1 = '订单退款拒绝'
						str2 = '感谢您对我们的信任，如有疑问请联系商家'
						str3 = this.info.refuseReason && '拒绝原因：' + this.info.refuseReason
						break;
				}
				return {
					str1,
					str2,
					str3,
					strimg,
				}
			},
			zqmArr() {
				console.log(this.info.selfCode && this.info.selfCode.split(''))
				return this.info.selfCode && this.info.selfCode.split('')
			},
			sl() {
				return this.info.symbol || this.system.symbol || '￥'
			},
			dsfps() {
				return this.info.deliveryMode != 1 && this.info.deliveryMode != 10
			},
		},
		methods: {
			async quxiao() {
				try {
					await this.util.modal('您确认取消订单吗？')
				} catch (e) {
					return
				}
				let data = await this.util.request({
					'url': this.api.wmddqx,
					method: 'POST',
					mask: '取消订单中',
					data: {
						orderId: this.info.id,
						note: '',
					},
				})
				if (data) {
					this.util.message('操作成功', 1)
					uni.navigateBack(1)
				}
			},
			async cuidan(e){
				var params = {
						userId: this.user.userId,
						orderId: e.id
					}
				try {
					await this.util.modal('您确认催单吗？')
				} catch (e) {
					return
				}
				let data = await this.util.request({
					'url': this.api.wmddcd,
					method: 'POST',
					mask: 1,
					data: params,
				})
				if (data) {
					this.util.message('操作成功', 1)
					uni.navigateBack(1)
				}
			},
			bddh(v) {
				this.util.makeTel(v.storeTel)
			},
			ckwz(v) {
				this.util.ckWz({
					lat: v.storeLat,
					lng: v.storeLng,
					name: v.storeName,
					address: v.address,
				})
			},
			async getInfo() {
				let {
					data
				} = await this.util.request({
					'url': this.api.wmddxq,
					mask: '加载中',
					data: {
						orderId: this.orderId
					},
				})
				if (data) {
					this.getisPop()
					this.info = data
					if (data.state == 1) {
						this.djs(data.createdAt)
					}
					if ((data.state == 3 || data.state == 4) && data.deliveryMode == 10) {
						this.getqcm()
					}
					return
					// console.log('111',this.dsfps)
					if (data.state == 4 && this.dsfps) {
						return
						this.latitude = data.userLat
						this.longitude = data.userLng
						this.covers = [{
								latitude: +data.userLat,
								longitude: +data.userLng,
								iconPath: '',
								width: '25',
								height: '25',
								callout: {
									content: `${data.receivedName}(${data.sex})`,
									color: '#333',
									fontSize: 12,
									borderRadius: 10,
									bgColor: '#fff',
									padding: 5,
									display: 'ALWAYS',
									textAlign: 'center',
								},
							},
							{
								latitude: +data.storeLat,
								longitude: +data.storeLng,
								iconPath: this.getImgS(data.storeIcon),
								width: '25',
								height: '25',
								callout: {
									content: data.storeName,
									color: '#333',
									fontSize: 12,
									borderRadius: 10,
									bgColor: '#fff',
									padding: 5,
									display: 'ALWAYS',
									textAlign: 'center',
								},
							}
						]
						// this.line = [{
						// 	color: this.tColor,
						// 	width: 3,
						// 	points: [{
						// 		latitude: +data.userLat,
						// 		longitude: +data.userLng
						// 	}, {
						// 		latitude: +data.storeLat,
						// 		longitude: +data.storeLng
						// 	}, ]
						// }]
						//如果有骑手经纬度
						if (data.deliveryInfo && data.deliveryInfo.riderLat) {
							this.covers = this.covers.concat([{
								latitude: +data.deliveryInfo.riderLat,
								longitude: +data.deliveryInfo.riderLng,
								iconPath: '/static/qs.png',
								width: '25',
								height: '25',
								callout: {
									content: data.deliveryInfo.riderName,
									color: '#333',
									fontSize: 12,
									borderRadius: 10,
									bgColor: '#fff',
									padding: 5,
									display: 'ALWAYS',
									textAlign: 'center',
								},
							}])
							// this.line[0].points = this.line[0].points.concat([{
							// 	latitude: +data.deliveryInfo.riderLat,
							// 	longitude: +data.deliveryInfo.riderLng
							// }, {
							// 	latitude: +data.userLat,
							// 	longitude: +data.userLng
							// }])
						}
					}
				}
			},
			async getqcm() {
				let {
					data
				} = await this.util.request({
					'url': this.api.zqqcm,
					mask: '加载中',
					data: {
						id: this.orderId
					},
				})
				this.qcmsrc = data
			},
			itemTotal(v) {
				let itemTotal = +(v.vipMoney > 0 && +v.vipMoney < +v.money && v.vipMoney || v.money)
				// if (v.material && v.material.length) {
				// 	v.material.forEach(v => {
				// 		itemTotal += v.number * v.outPrice
				// 	})
				// }
				return +(itemTotal * v.num).toFixed(2)
			},
			djs(time) {
				//13:55
				if (this.info.state != 1 || this.orderset.autoClose != 1) return
				let now = this.dateToTime(),
					time2 = +time + this.orderset.closeTime * 60
				if (time2 > now) {
					this.stime = utils.countDownTime(time2 - now)
					this.dsq = setInterval(async () => {
						time2 -= 1
						if (time2 == now) {
							clearInterval(this.dsq)
							this.go({
								t: 4
							})
						}
						this.stime = utils.countDownTime(time2 - now)
					}, 1000)
				}
			},
			psxq() {},
			async operation(type, co) {
				let obj = {}
				if (type == 'sqtk') {
					if (co.state == 2) {
						return this.qxdd(1)
					}
					obj = {
						title: '您确认取消订单吗？',
						url: 'wmddtk',
						params: {
							orderId: co.id,
							note: '',
						}
					}
				} else if (type == 'cd') {
					obj = {
						title: '您确认催单吗？',
						url: 'wmddcd',
						params: {
							// userId: this.user.userId,
							orderId: co.id
						}
					}
				} else if (type == 'qrsh') {
					obj = {
						title: '您确认已收到货吗？',
						url: 'wmddsh',
						params: {
							orderId: co.id
						}
					}
				} else if (type == 'ljzf') {
					this.go({
						t: 1,
						url: '/yb_wm/other/mg-pay?payObj=' + encodeURIComponent(JSON.stringify({
							orderId: co.id,
							orderType: 1,
							info: {
								money: co.money,
								storeName: co.storeName,
								type: "下单支付",
								cancel: 1,
								go: ({
									t: 6,
									url: '/yb_wm/index/order-index'
								})
							}
						}))
					})
					return;
				}
				try {
					await this.util.modal(obj.title)
				} catch (e) {
					return
				}
				let data = await this.util.request({
					'url': this.api[obj.url],
					method: 'POST',
					mask: 1,
					data: obj.params,
				})
				if (data) {
					this.util.message('操作成功', 1)
					this.go({
						t: 6,
						url: '/yb_wm/index/order-index'
					})
				}
			},
			async caozuo(info) {
				await this.util.modal('您确认再来一单吗？')
				this.go({
					t: 3,
					url: '/yb_wm/index/goods?storeId=' + info.storeId
				})
			},
			async qxdd(e) {
				if (e) {
					try {
						await this.util.modal('您确认取消订单吗？')
					} catch (e) {
						return
					}
				}
				let data = await this.util.request({
					'url': this.api.wmddqx,
					method: 'POST',
					mask: '取消订单中',
					data: {
						orderId: this.info.id,
						note: '',
					},
				})
				if (data) {
					this.util.message('操作成功', 1)
					this.go({
						t: 6,
						url: '/yb_wm/index/order-index'
					})
				}
			},
			ckwz(info) {
				this.util.ckWz({
					lat: info.storeLat,
					lng: info.storeLng,
					name: info.storeName,
					address: info.address,
				})
			},
			async getisPop() {
				let {
					data
				} = await this.util.request({
					'url': this.api.ispop,
					data: {
						orderId: this.orderId,
					}
				})
				this.hbId = data ? data.id : ''
				this.config = data
				// #ifdef  H5
				let link = getSLink(`yb_wm/shop/gfhb/gfhb?id=${this.hbId}&userId=${this.uId}`)
				wxShare({
					title: this.config.shareTitle,
					desc: '送你一个拼手气红包!',
					link,
					imgUrl: this.getImgS(this.config.shareImg),
				})
				// #endif
			},
			showhb() {
				this.showRed = true
			},
			fhb() {
				this.showRed = false
			},
			fanhui() {
				uni.navigateBack(1)
			},
		},
		onUnload() {
			this.dsq && clearInterval(this.dsq)
		},
		onShareAppMessage() {
			let p = `yb_wm/shop/gfhb/gfhb?id=${this.hbId}&userId=${this.uId}`
			return this.util.mpShare({
				t: this.config.shareTitle,
				i: this.getImgS(this.config.shareImg),
				p,
			})
		}
	}
</script>

<style scoped lang="scss">
	.padtt {
		padding-top: 30rpx;
	}

	.hbtb {
		position: fixed;
		right: 20rpx;
		z-index: 999;
	}

	.obtn {
		margin: 0 25rpx 0 0;
	}

	.map {
		width: 690rpx;
		height: 400rpx;
	}

	.zqmc {
		width: 80rpx;
		height: 80rpx;
		border-radius: 10rpx;
		border: 1px dashed #ddd;
	}

	.zqmyz {
		padding: 20rpx 30rpx;
		background: #F5F5F5;
	}

	.zqmimg {
		width: 380rpx;
		height: 380rpx;
		margin: 20rpx auto;
	}

	.qhbimg {
		width: 357rpx;
		height: 266rpx;
	}

	.hbimg {
		width: 50rpx;
		height: 60rpx;
	}

	.hgc {
		top: 30rpx;
		left: 30rpx;
		padding: 3rpx 12rpx;
		border-radius: 0 0 15rpx 0;
	}

	.hdspan {
		margin-top: 8rpx;
	}

	.ddztimg {
		width: 100rpx;
		height: 100rpx;
	}

	.anniuimg {
		width: 40rpx;
		height: 40rpx;
	}
</style>